package test.example.controller.ajax.user;

import java.util.Map;

import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;
import org.slim3.util.RequestMap;

import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

public class CreateLogoutURLController extends Controller {

    @Override
    public Navigation run() throws Exception {
        Map requestMap = new RequestMap(request);
        String forwardPath = (String) requestMap.get("entryPointPath");
        UserService userService = UserServiceFactory.getUserService();
        //logout用URLでは開発環境ではログアウトできない模様
        String resultURL = userService.createLogoutURL(forwardPath);

        response.getWriter().print(resultURL);
        return null;
    }
}
